package com.bmft.project02;

import com.bmft.project02.string.impl.LinkedString;
import org.junit.jupiter.api.Test;
import org.omg.PortableServer.POAPackage.InvalidPolicyHelper;
import org.w3c.dom.stylesheets.LinkStyle;

import java.util.LinkedList;

/**
 * @author Jarvan
 * @version 1.0
 * @create 2020/9/24 13:25
 */
public class MethodTest02 {

    @Test
    public void test(){
        LinkedString<Character> h = new LinkedString<>('0');
        System.out.println(h.getNode(0));
        h.insertLast('1');
        h.insert(1,'a');
        System.out.println(h.getNode(1));
    }

    /**
     * Test the constructor of String params.
     */
    @Test
    public void testConstructor(){
        LinkedString<Character> hello = new LinkedString<>("hello LinkedString");
        System.out.println(hello);
    }

    /**
     * Test concat.
     */
    @Test
    public void testConcat(){
        LinkedString<Character> hello = new LinkedString<>("hello ");
        LinkedString<Character> linkedString = new LinkedString<>("LinkedString");
        System.out.println("before concat="+hello);
        LinkedString<Character> concat = hello.concat(linkedString);
        System.out.println("after concat="+concat);
    }

    /**
     * CharAt() test
     */
    @Test
    public void testCharAt(){
        LinkedString<Character> hello = new LinkedString<>("hello");
        System.out.println(hello);
        System.out.println(hello.charAt(0));
    }

    /**
     * Test length.
     */
    @Test
    public void testLength(){
        LinkedString<Character> hello = new LinkedString<>("hello");
        System.out.println(hello);
        System.out.println(hello.length());
    }

    /**
     * Test sub String.
     */
    @Test
    public void testSubString(){
        LinkedString<Character> hello = new LinkedString<>("hello");
        LinkedString<Character> characterLinkedString = hello.subString(0, 1);
        System.out.println(characterLinkedString);
        System.out.println(hello);
    }

}
